/******************************************************************************
**                                                                           **
**                 Proprietary and Confidential Information                  **
**                                                                           **
**                 Copyright (c) SigmaTel, Inc. Unpublished                  **
**                                                                           **
** This source code and the algorithms implemented therein constitute        **
** confidential information and may compromise trade secrets of SigmaTel,    **
** Inc. or its associates, and any unauthorized use thereof is prohibited.   **
**                                                                           **
******************************************************************************/

#ifndef __imgbufio_h__
#define __imgbufio_h__

#include "dc_image_api.h"

//
// WARNING ... this module is only in pre-infancy stage.  Please do not use
// as APIs are likely to change.
//

//
// This module is meant to provide an easy way to transfer IMGBUF type images
// between firmware and dbgmon PC filesystem.  It will understand standard
// IMGBUF image attributes, and perform appropriate mapping as image data is
// read/write from files on PC.
//

typedef enum {
  IMGBUFIO_MODE_DumpFromFirmware,
  IMGBUFIO_MODE_LoadToFirmware
} IMGBUFIO_MODE_t;

typedef struct 
{

  IMGBUFIO_MODE_t mode;

  DC_IMAGE_CHANNELS channels;
  DC_IMAGE_BITDEPTH bitdepth;
  DC_IMAGE_FORMAT format;
  void *base;
  UINT32 stride;
  UINT32 ySize;
  UINT32 width;
  UINT32 height;
  UINT32 yStart;

  FILE *fp;
  FILE *fp_desc;

  int nChannels;
  int compositeStride;
  UINT32 yValue;
  int nLines;

  UINT32 src_plane_size;
  UINT32 dst_plane_size;

  int stride_mode;

} IMGBUFIO_t;

CPP DBGMON_API int IMGBUFIO_DumpFromFirmware_Open
( IMGBUFIO_t *imgbufio,
  char *clientInfo,
  char *fileNamePrefix,
  char *options,
  DC_IMAGE_CHANNELS channels,
  DC_IMAGE_BITDEPTH bitdepth,
  DC_IMAGE_FORMAT format,
  void *base,
  UINT32 stride,
  UINT32 ySize,
  UINT32 width,
  UINT32 height,
  UINT32 yStart,
  UINT32 lines); // dump all if zero.

CPP DBGMON_API int IMGBUFIO_LoadToFirmware_Open
( IMGBUFIO_t *imgbufio,
  char *clientInfo,
  char *filename,
  char *options,
  DC_IMAGE_CHANNELS channels,
  DC_IMAGE_BITDEPTH bitdepth,
  DC_IMAGE_FORMAT format,
  void *base,
  UINT32 stride,
  UINT32 ySize,
  UINT32 width,
  UINT32 height,
  UINT32 yStart );

CPP DBGMON_API int IMGBUFIO_TransferLines
( IMGBUFIO_t *imgbufio,
  UINT32 nLines );
  
CPP DBGMON_API int IMGBUFIO_Close
( IMGBUFIO_t *imgbufio );

#endif
